<template>
  <div>
        <div class="menuleft">
            <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose">
                <el-menu-item index="1">
                    <router-link to="/home"><i class="icon iconfont icon-ziyuan"></i>返回首页</router-link>
                </el-menu-item>
                <el-submenu index="2" v-if="permissions.indexOf('采购管理')>-1">
                    <template slot="title">
                        <router-link to="/PurchaseManage"><i class="icon iconfont icon-caigou">&nbsp;</i>采购管理</router-link>
                    </template>
                    <el-menu-item index="2-1" v-if="permissions.indexOf('采购订单')>-1">
                        <router-link to="/BOMPurchaseOrder">采购订单</router-link>
                    </el-menu-item>
                    <el-menu-item index="2-2" v-if="permissions.indexOf('采购入仓单')>-1">
                        <router-link to="/PurchaseIn">采购入仓单</router-link>
                    </el-menu-item>
                    <el-menu-item index="2-3" v-if="permissions.indexOf('采购进货单')>-1">
                        <router-link to="/PurchaseImport">采购进货单</router-link>
                    </el-menu-item>
                    <el-menu-item index="2-4" v-if="permissions.indexOf('采购发票')>-1">
                        <router-link to="/PurchaseInvoice">采购发票</router-link>
                    </el-menu-item>
                    <el-menu-item index="2-5" v-if="permissions.indexOf('付款单')>-1">
                        <router-link to="/PurchasePayment">采购付款单</router-link>
                    </el-menu-item>
                    
                </el-submenu>
                <el-submenu index="3" v-if="permissions.indexOf('销售管理')>-1">
                    <template slot="title">
                        <router-link to="/SaleManage"><i class="icon iconfont icon-xiaoshou">&nbsp;</i>销售管理</router-link>
                    </template>
                    <el-menu-item index="3-1" v-if="permissions.indexOf('销售订单')>-1">
                        <router-link to="/SaleOrder">销售订单</router-link>
                    </el-menu-item>
                    <el-menu-item index="3-2" v-if="permissions.indexOf('销售出仓单')>-1">
                        <router-link to="/SaleWarehouseReceipt">销售出仓单</router-link>
                    </el-menu-item>
                    <el-menu-item index="3-3" v-if="permissions.indexOf('销售发票')>-1">
                        <router-link to="/SaleInvoice">销售发票</router-link>
                    </el-menu-item>
                    <el-menu-item index="3-4" v-if="permissions.indexOf('收款单')>-1">
                        <router-link to="/RcvSingle">收款单</router-link>
                    </el-menu-item>
                </el-submenu>
            </el-menu>
        </div>
        <router-view></router-view>
  </div>
</template>
<script>
import { 
    mapState, 
    mapGetters 
} from 'vuex'
export default {
    name: "SupplyChain",
    data() {
        return {
        }
    },
    computed: {
            ...mapGetters({
                permissions: 'permissions'
            })
    },
    methods:{
        handleOpen(key, keyPath){
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        }
    },
}
    
</script>
<style>

</style>

